<template>
	<view class="wui-timeLine" :style="[styleComputed]">
		<slot></slot>
	</view>
</template>

<script>
	export default {
		name: 'w-timeLine',
		props: {
			nodeLeft: {
				type: [String, Number],
				default: 100
			},
			background:{
				type: String,
				default: '#fff'
			}
		},
		computed: {
			styleComputed() {
				return {
					'--node-left': uni.upx2px(this.nodeLeft) + 'px',
					'--background':this.background
				}
			}
		}
	}
</script>

<style lang="scss" scoped>
	.wui-timeLine {
		padding-left: var(--node-left);
		position: relative;
		background-color: var(--background);
	}

	.wui-timeLine:before {
		content: " ";
		position: absolute;
		left: calc(var(--node-left) / 2);
		top: 0;
		width: 1px;
		bottom: 0;
		border-left: 1px solid #999;
		transform-origin: 0 0;
		transform: scaleX(.5);
	}
</style>
